<template>
  <div class="app-container">
    <el-form ref="form" :model="form" :rules="rules" size="small" label-width="200px">
     <h3>平台账户充值</h3>
     <h4>资产剩余:xxx元</h4>
      <el-form-item label="资产充值" prop="recommend">
        <el-input class="input-se" v-model="form.recommend" />
        <el-button class="but" type="primary" @click="doSubmit" :loading="columnLoading">提交申请</el-button>
        <!-- <span class="input-tips">金豆抵用比例（1个金豆抵多少金额）</span> -->
      </el-form-item>
           <h4>积分剩余:xxx分</h4>
      <el-form-item label="积分充值" prop="recommendSuperior">
        <el-input class="input-se" v-model="form.recommendSuperior" />
        <el-button class="but" type="primary" @click="doSubmit" :loading="columnLoading">提交申请</el-button>

        <!-- <span class="input-tips">金豆达到多少数量后才可以释放成我的资产</span> -->
      </el-form-item>
   
     
      <!-- <div class="title">金豆打赏比例分配：</div> -->
      <!-- <el-form-item>
        <el-button class="but" type="primary" @click="doSubmit" :loading="columnLoading">保存</el-button>
      </el-form-item> -->
    </el-form>
  </div>
</template>

<script>
import { add, getQuery } from '@/api/yxGoldenBeanManagement'
export default {
  name: 'Preview',
  data() {
    return {
      form: {},
      rules: {
        recommend: [
          { required: true, message: '请填写邀请者比例', trigger: 'blur' }
        ],
        recommendSuperior: [
          { required: true, message: '请填写邀请者上级比例', trigger: 'blur' }
        ],
        registerUser: [
          { required: true, message: '请填写注册者比例', trigger: 'blur' }
        ],
        total: [{ required: true, message: '请填写金豆总数', trigger: 'blur' }]
      },
      columnLoading: false
    }
  },
  created() {},
  mounted() {
    this.getQueryConfig()
  },
  methods: {
    getQueryConfig() {
      getQuery({ type: 'invitation' })
        .then((res) => {
          if (res.status == '1') {
            this.form = JSON.parse(res.data.configDescribe)
          }
        })
        .catch((err) => {
          console.log(err.response.data.message)
        })
    },
    doSubmit() {
      this.columnLoading = true
      add(this.form)
        .then((res) => {
          this.notify('保存成功', 'success')
          this.columnLoading = false
          this.getQueryConfig()
        })
        .catch((err) => {
          this.columnLoading = false
          console.log(err.response.data.message)
        })
    }
  }
}
</script>

<style lang="scss" scoped>
.input-se {
  width: 200px;
  margin-right: 15px;
}
.input-tips {
  color: rgb(217, 0, 27);
  font-size: 10px;
  margin-left: 20px;
}
.title {
  width: 200px;
  text-align: right;
  padding-right: 12px;
  line-height: 32px;
  color: #606266;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 18px;
}
h4{
  margin-left: 125px;

}
.but {
//   margin-left: 145px;
}
</style>
